#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e6 + 5;

int n, m;
int a[N];
struct Node {
  int mx;
  int ch[2];
} tr[N * 50];
#define mx(p) tr[p].mx
#define lc(p) tr[p].ch[0]
#define rc(p) tr[p].ch[1]
int newnode(int p) {
  static int tot = 0;
  ++tot;
  lc(tot) = lc(p);
  rc(tot) = rc(p);
  mx(tot) = mx(p);
  return tot;
}
void build(int& p, int l, int r) {
  if (!p) p = newnode(0);
  if (l == r) {
    mx(p) = a[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(lc(p), l, mid);
  build(rc(p), mid + 1, r);
  // pushup
}
void update(int x, int v, int& p, int l, int r) {
  p = newnode(p);
  if (l == r) {
    mx(p) = v;
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid)
    update(x, v, lc(p), l, mid);
  else
    update(x, v, rc(p), mid + 1, r);
}
int query(int x, int p, int l, int r) {
  if (l == r) return mx(p);
  int mid = (l + r) >> 1;
  if (x <= mid)
    return query(x, lc(p), l, mid);
  else
    return query(x, rc(p), mid + 1, r);
}
int root[N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> a[i];
  build(root[0], 1, n);
  rep(i, 1, m) {
    int v, op, x, y;
    cin >> v >> op;
    root[i] = root[v];
    if (op == 1) {
      cin >> x >> y;
      update(x, y, root[i], 1, n);
    } else {
      cin >> x;
      cout << query(x, root[i], 1, n) << endl;
    }
  }
  return 0;
}